{% extends 'admin/common/base.html' %}
{% block body %}

<body class="gray-bg">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="role-form">
                    <div class="select-list">
                        <ul>
                            <li>
                                账号：<input type="text" name="oper_name" />
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-danger" onclick="$.operate.clean()">
	                <i class="fa fa-trash"></i> 清空
	            </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
</body>
{% endblock %}
{% block js %}
{{ super() }}
<script>
    var state_datas = {{get_dict_data('sys_optlog_state') | tojson | safe}};
    $(function () {
        var options = {
            url: "{{url_for('admin.sys.optlog.list')}}",
            cleanUrl: "{{url_for('admin.sys.optlog.clean')}}",
            detailUrl: "{{url_for('admin.sys.optlog.detail')}}?id={id}",
            createUrl: "{{url_for('admin.sys.optlog.add')}}",
            updateUrl: "{{url_for('admin.sys.optlog.edit')}}?id={id}",
            removeUrl: "{{url_for('admin.sys.optlog.remove')}}",
            exportUrl: "{{url_for('admin.sys.optlog.export')}}",
            modalName: "操作日志",
            columns: [
            {
                checkbox: true
            },
            {
                field: 'id',
                title: '日志编号',
            },
            {
                field: 'title',
                title: '模块名称'
            },
            {
                field: 'opt_name',
                title: '操作'
            },
            {
                field: 'method',
                title: '方法名称'
            },
            {
                field: 'oper_url',
                title: '请求URL'
            },
            {
                field: 'request_method',
                title: '请求方式'
            },
            {
                field: 'oper_name',
                title: '操作人员'
            },
            {
                field: 'ipaddr',
                title: '主机地址'
            },
            {
                field: 'login_location',
                title: '操作地点'
            },
            {
                field: 'browser',
                title: '浏览器类型'
            },
            {
                field: 'ossystem',
                title: '操作系统'
            },
            {
                field: 'state',
                title: '操作状态',
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(state_datas, value);
                }
            },
            {
                field: 'msg',
                title: '提示消息'
            },
            {
                field: 'oper_time',
                title: '访问时间'
            },
            {
                title: '操作',
                align: 'center',
                formatter: function (value, row, index) {
                    var actions = [];
                    //actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                    //actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
                    actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-search"></i>详细</a>');
                    return actions.join('');
                }
            }]
        };
        $.table.init(options);
    });

</script>
{% endblock %}